class Card extends egret.Bitmap {
	// 牌的属性和方法
	public isSelected: boolean = false;
	// 牌的信息
	public info = null;



	public constructor(obj = { icon: 'bg.jpg', type: '-1', val: 0 }) {
		super(RES.getRes(obj.icon.split('.')[0]));
		this.info = obj;
	}
	public start() {
		this.touchEnabled = true;
		// 给每一个纸牌绑定一个事件
		this.addEventListener(egret.TouchEvent.TOUCH_TAP, this.cardClick, this);
	}

	// 选中纸牌,纸牌上移
	public cardClick() {
		var self = this;
		if (self.isSelected) {
			this.anchorOffsetY = 0;
		} else {
			this.anchorOffsetY = 28;
		}
		// 改变选中状态
		self.isSelected = !self.isSelected;
		// 根据选中牌的类型是否合适来让出牌按钮显示和隐藏
		// console.log(PlayCard.getReadyCardsKind());

		var btn:MBtn = SceneManager.getInstance().gamePlayingPanel.playBtns.btnArr[2];
		if (PlayCard.getReadyCardsKind()) {
			// 出牌按钮可点击
			// console.log('可出牌')
			btn._bg.texture = RES.getRes('primary')
			btn.touchEnabled = true;
		} else {
			// 出牌按钮不可点击
			// console.log('不可出牌')
			btn._bg.texture = RES.getRes('warn')
			btn.touchEnabled = false;
		}
	}
}